using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class NeverSkill0Area : TriggerSkillCollider
{
    public void Init(SkillData data, float radius, Vector3 pos, bool isShow = true)
    {
        Initialize(data, radius, isShow);
        transform.position = pos;
    }

    public override void Initialize(SkillData data, float radius, bool isShow = true)
    {
        base.Initialize(data, radius, isShow);

        transform.localScale = new Vector3(radius * 0.2f, radius * 0.2f, 1);
        StartCoroutine(ThisSkill(data));
    }

    private IEnumerator ThisSkill(SkillData info)
    {
        yield return new WaitForSeconds(1);
        foreach (GameObject obj in targets.ToList())
        {
            if (obj.TryGetComponent(out Character tar))
            {
                info.Source.ApplyDamage(tar, info, canFeedback);
            }
        }
        Destroy();
    }
}
